import { getAllCompanyApi } from "@/api/managementCenter/departmentPersonnel";
import { reactive, ref } from "vue";

export default function InitHook() {
  const formDataRef = ref<any>(null);
  const loading = ref<boolean>(false);
  const formState = reactive<{ companyId: string | undefined; file: Array<File> }>({
    companyId: undefined,
    file: []
  });
  const companyOpts = ref<Array<Base.GeneraDataType>>([]);
  const getAllCompany = () => {
    return getAllCompanyApi({ status: 1, pageNum: 1, pageSize: 999999 }).then((res: any) => {
      const { code, data } = res;
      if (code === 200) {
        companyOpts.value = data || [];
      }
    });
  };
  return {
    formState,
    loading,
    formDataRef,
    companyOpts,
    getAllCompany
  };
}
